小编Ste*_*ers的帖子

在PyCharm IDE中嵌入Plotly HTML

我想在PyCharm IDE中看到Plotly的HTML输出.它目前说:

进程以退出代码0结束

输出.但是,我在Jupyter中收到了一个图形结果

html python pycharm plotly jupyter

5
推荐指数
1
解决办法
5046
查看次数

Python中的矩阵镜像

我有一个数字矩阵:

[[a, b, c] 
 [d, e, f] 
 [g, h, i]]
Run Code Online (Sandbox Code Playgroud)

我想据此进行镜像:

[[g, h, i]
 [d, e, f]
 [a, b, c] 
 [d, e, f] 
 [g, h, i]]
Run Code Online (Sandbox Code Playgroud)

然后再次产生:

[[i, h, g, h, i]
 [f, e, d, e, f]
 [c, b, a, b, c] 
 [f, e, d, e, f] 
 [i, h, g, h, i]]
Run Code Online (Sandbox Code Playgroud)

我想坚持使用像numpy这样的基本Python包。在此先感谢您的帮助!

python arrays numpy matrix python-3.x

5
推荐指数
2
解决办法
6766
查看次数

在 Heroku 中设置 Python Conda 环境

背景

我使用此处的指南在我的项目目录中创建了一个用于 conda 环境的 heroku 实例: conda-buildpack

错误

sterlingbutters$ git push heroku master
Counting objects: 7, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 2.68 KiB | 2.68 MiB/s, done.
Total 7 (delta 1), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Python/Conda app detected
remote: -----> Preparing Python/Miniconda Environment (3.8.3)
remote: /app/tmp/buildpacks/2abac4b7166986c6b1b33fcacccb13fb4e2036a9358f31ed8886bbf37c9987c7fbb8243090f0438ebbf02852a1cbeb1b5cae47f67dc2670115ce6d7bd2468300/bin/steps/conda_compile: line 9: conda: command not found
remote:  !     Push rejected, failed …
Run Code Online (Sandbox Code Playgroud)

python pip heroku anaconda conda

5
推荐指数
1
解决办法
1635
查看次数

Python:计算两个纬度/经度之间的方位

我正在尝试计算两个纬度/经度之间的方位。

我对功能/公式本身没有疑问,

提供:

def get_bearing(lat1, long1, lat2, long2):
    dLon = (long2 - long1)

    y = math.sin(dLon) * math.cos(lat2)
    x = math.cos(lat1) * math.sin(lat2) - math.sin(lat1) * math.cos(lat2) * math.cos(dLon)

    brng = math.atan2(y, x)

    brng = np.rad2deg(brng)

    return brng
Run Code Online (Sandbox Code Playgroud)

问题是结果不是预期的。

该函数的预期用途返回(很长)列表中两个经纬度对之间的方位,即

    lat1 = path[int(len(path) * location / 1000)][0]
    lat2 = path[int(len(path) * location / 1000) + 1][0]
    lng1 = path[int(len(path) * location / 1000)][1]
    lng2 = path[int(len(path) * location / 1000) + 1][1]
Run Code Online (Sandbox Code Playgroud)

然后,方位结果会更改图的视图方向,其中方位可以采用[-180,180]范围内的值。理想情况下,结果应显示为使得lat1,lng1和lat2,lng2之间形成的线在图中完全是“垂直”的(在图中切换了经纬度注释),请参见下文

在此处输入图片说明

在此处输入图片说明

我希望有人可以从函数返回的方位以及预期方位应该是什么来推断问题。以下是一些实例:

Current Location: 30.07134 -97.23076
Next …
Run Code Online (Sandbox Code Playgroud)

python function latitude-longitude plotly-dash

4
推荐指数
3
解决办法
1751
查看次数

Amazon Lightsail:Bitnami LAMP服务器网站托管:sudo服务apache2重新启动

我正在尝试按照此处的指南进行操作:http : //www.servermom.org/how-to-add-new-site-into-your-apache-based-ubuntu-server/ 在网络上托管一些PHP文件。一切正常,直到倒数第二个步骤:标题中的命令。我收到的控制台消息如下:

bitnami@ip-*not important*:~$ sudo service apache2 restart
 * Restarting web server apache2        
AH00112: Warning: DocumentRoot [/var/www/html] does not exist
AH00558: apache2: Could not reliably determine the server's fully qualified do
main name, using 127.0.0.1. Set the 'ServerName' directive globally to suppres
s this message
(98)Address already in use: AH00072: make_sock: could not bind to address [::]
:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.
0.0:80
no listening sockets available, shutting down …
Run Code Online (Sandbox Code Playgroud)

apache web-hosting amazon-web-services server amazon-lightsail

3
推荐指数
1
解决办法
1747
查看次数