我尝试按照https://geoffboeing.com/2017/02/python-getting-started/此处概述的步骤在计算机上的Python 3中安装osmnx软件包。这些步骤是:
C:\Anaconda
。我正在使用大学计算机,因此无法执行此操作。但是,Anaconda已安装在这些计算机上,其路径为C:\Program Files \Anaconda3
。 conda update -n base conda
。但是,这没有完成,因为我没有“对目标环境具有写权限”(C:\Program Files \Anaconda3
)。conda config --prepend channels conda-forge
运行良好。 conda create -n ox -c conda-forge osmnx jupyterlab
和conda activate ox
运行良好。在安装的Anaconda Navigator>环境> ox>中列出了OSMnx和jupyterlab。jupyter lab
,但这产生了以下错误。很抱歉给我这么大的报价,但我不知道该怎么解释:(ox) C:\Users\bm17652>jupyter lab
[I 15:47:48.265 LabApp] Writing notebook server cookie secret to C:\Users\bm17652\AppData\Roaming\jupyter\runtime\notebook_cookie_secret
Traceback (most recent call last):
File "C:\Users\bm17652\.conda\envs\ox\Scripts\jupyter-lab-script.py", line 9, in <module>
sys.exit(main())
File "C:\Users\bm17652\.conda\envs\ox\lib\site-packages\jupyter_core\application.py", line 268, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "C:\Users\bm17652\.conda\envs\ox\lib\site-packages\traitlets\config\application.py", line 663, in launch_instance
app.initialize(argv)
File "<C:\Users\bm17652\.conda\envs\ox\lib\site-packages\decorator.py:decorator-gen-7>", line 2, in initialize
File "C:\Users\bm17652\.conda\envs\ox\lib\site-packages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "C:\Users\bm17652\.conda\envs\ox\lib\site-packages\notebook\notebookapp.py", line 1679, in initialize
self.init_webapp()
File "C:\Users\bm17652\.conda\envs\ox\lib\site-packages\jupyterlab\labapp.py", line 404, in init_webapp
super().init_webapp(*args, **kwargs)
File "C:\Users\bm17652\.conda\envs\ox\lib\site-packages\notebook\notebookapp.py", line 1442, in init_webapp
self.http_server.listen(port, self.ip)
File "C:\Users\bm17652\.conda\envs\ox\lib\site-packages\tornado\tcpserver.py", line 152, in listen
self.add_sockets(sockets)
File "C:\Users\bm17652\.conda\envs\ox\lib\site-packages\tornado\tcpserver.py", line 165, in add_sockets
self._handlers[sock.fileno()] = add_accept_handler(
File "C:\Users\bm17652\.conda\envs\ox\lib\site-packages\tornado\netutil.py", line 279, in add_accept_handler
io_loop.add_handler(sock, accept_handler, IOLoop.READ)
File "C:\Users\bm17652\.conda\envs\ox\lib\site-packages\tornado\platform\asyncio.py", line 99, in add_handler
self.asyncio_loop.add_reader(fd, self._handle_events, fd, IOLoop.READ)
File "C:\Users\bm17652\.conda\envs\ox\lib\asyncio\events.py", line 501, in add_reader
raise NotImplementedError
NotImplementedError
当我尝试从Anaconda Navigator打开Jupyter Lab并运行import osmnx as ox
时,出现错误“没有名为'osmnx'的模块”。
在我看来,Jupyter Lab似乎安装不正确,或与osmnx的连接不正确。 发生这些错误是因为:
C:\Users\bm17652
)不同的目录(C:\Program Files \Anaconda3
)运行代码吗?答案 0 :(得分:2)
我遇到了类似的问题。解决方案是创建一个为OSMnx指定的新完整环境。可以使用
conda config --prepend channels conda-forge
conda create -n ox --strict-channel-priority osmnx
然后您必须使用以下方法激活该环境:
(base) C:\Users\User>conda activate ox
之后,您可以运行:
(ox) C:\Users\User>python
>>> import osmnx as ox
>>>
测试安装是否成功
答案 1 :(得分:0)
我conda install osmnx
然后conda install gdal=2.4.4
,它起作用了!!!
感谢这里的链接 >>> fiona import issues in python